package com.alliance.shuwei.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import com.alliance.shuwei.entity.Company;
import com.alliance.shuwei.service.CompanyService;

@Controller
@RequestMapping("/admin/company")
public class CompanyController {
	private static final Logger logger = LoggerFactory.getLogger(CompanyController.class);
	@Autowired
	private CompanyService companyService;
	@RequestMapping(method=RequestMethod.GET)
	public ModelAndView getCompany(){
		ModelAndView mv = new ModelAndView("company");
		Company company = companyService.getCompany();
		mv.addObject("company",company);
		return mv;
	}
	@RequestMapping(method=RequestMethod.POST)
	public ModelAndView updateCompany(Company company){
		companyService.saveCompany(company);
		ModelAndView mv = new ModelAndView("company");
		mv.addObject("company",company);
		return mv;
	}
	
}
